package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import bean.*;

public class HibernateUtil
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	 config.addAnnotatedClass(FormaDePago.class);
        	 config.addAnnotatedClass(Efectivo.class);
        	 config.addAnnotatedClass(TarjetaCredito30.class);
        	 config.addAnnotatedClass(TarjetaCredito60.class);
             config.addAnnotatedClass(Proveedor.class);
             config.addAnnotatedClass(ProductoID.class);
             config.addAnnotatedClass(Producto.class);
             config.addAnnotatedClass(Item_ListaPrecios.class);
             config.addAnnotatedClass(ListaDePreciosID.class);
             config.addAnnotatedClass(ListaDePrecios.class);
        	 config.addAnnotatedClass(Cliente.class);
        	 config.addAnnotatedClass(Item_SolicitudCliente.class);
        	 config.addAnnotatedClass(SolicitudDeCotizacionID.class);
        	 config.addAnnotatedClass(SolicitudDeCotizacion.class);
        	 config.addAnnotatedClass(Item_Cotizacion.class);
        	 config.addAnnotatedClass(Cotizacion.class);
        	 config.addAnnotatedClass(Item_OrdenDePedido.class);
        	 config.addAnnotatedClass(OrdenDePedido.class);
        	 config.addAnnotatedClass(Item_OrdenDeCompra.class);
        	 config.addAnnotatedClass(OrdenDeCompra.class);
        	 config.addAnnotatedClass(Movimiento.class);
        	 config.addAnnotatedClass(Item_Remito.class);
        	 config.addAnnotatedClass(Remito.class);
        	 config.addAnnotatedClass(Factura.class);
        	 config.addAnnotatedClass(Item_Factura.class);
             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
 
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
